package base;

import regions.Region;

//Class for a matrix element position x and y and number of rocks in it
public class Tower implements Comparable<Tower>{
	//Position
	public int x;
	public int y;
	
	//Contents
	public int rocks;
	
	//Current containing region
	public Region region;
	
	//Constructors
	public Tower(int x, int y,int rocks)
	{
		this.x = x;
		this.y = y;
		this.rocks = rocks;
	}
	
	public Tower(int x, int y)
	{
		this(x,y,0);
	}


	@Override
	public int compareTo(Tower o) {
		if (this.rocks < o.rocks)
			return -1;
		else 
			if (this.rocks > o.rocks)
				return 1;
			else
				return 0;
	}
	
	//Check whether two Towers are next to each other
	public boolean isNextTo(Tower anotherTower)
	{
		if ((this.x - anotherTower.x +this.y -anotherTower.y) <=1)
		{
			return true;
		}
		else
			return false;
	}
	
	
	
}
